package org.luxor.eshop.payment.service.hystrix;

import org.luxor.commons.core.web.data.R;
import org.luxor.eshop.payment.entity.dto.OrderDto;
import org.luxor.eshop.payment.service.OrderFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import static org.luxor.commons.core.web.RestStatus.FEIGN_HYSTRIX;

/**
 * 熔断实现
 *
 * @author Mr.Yan  @date: 2020/9/2
 */
@Component
public class OrderHystrixImpl implements OrderFeign {
    private static Logger logger = LoggerFactory.getLogger(OrderHystrixImpl.class);

    @Override
    public R<OrderDto> get(Long orderId) {
        logger.warn("get Method Response Hystrix Data");
        return R.failed(FEIGN_HYSTRIX, new OrderDto());
    }

    @Override
    public R paySuccess(Long orderId) {
        logger.warn("paySuccess Method Response Hystrix Data");
        return R.failed(FEIGN_HYSTRIX);
    }


    @Override
    public R payFailed(Long orderId) {
        logger.warn("payFailed Method Response Hystrix Data");
        return R.failed(FEIGN_HYSTRIX);
    }
}

